<%@page import="multiface.promonet.jpa.Lavoro"%>
<%@page import="javax.persistence.EntityManager"%>
<%@page import="multiface.promonet.jpa.util.PersistenceManager"%>
<%@page import="javax.persistence.EntityManagerFactory"%>
<%@page import="javax.persistence.EntityManagerFactory"%>
<%@page import="multiface.web.util.Util"%>
<%
    String where = request.getParameter("where");
    if (where == null) {
        where = "open";
    }
    String css = "margin-left:6px;color:#000;";
    String open = "";
    String close = "";
    if (where.equals("open")) {
        open = css;
    }
    if (where.equals("close")) {
        close = css;
    }

    EntityManagerFactory emf = PersistenceManager.getInstance().getEntityManagerFactory();
    EntityManager em = emf.createEntityManager();

    int idLav = Integer.parseInt(request.getParameter("lavoroid"));
    Lavoro lav = em.find(Lavoro.class, idLav);

%>
<style>
    .search{
        border:1px solid #ccc;
        font-size: 10px; 
        width: 150px;
        padding: 2px;
    }
    .search2{
        border:1px solid #ccc;
        font-size: 10px; 
        width: 150px;
        padding: 2px;
    }
</style>
<script>
    $(document).ready(function() {
        $("a.group").fancybox({
            'transitionIn':'elastic',
            'transitionOut':'elastic',
            'speedIn':400, 
            'speedOut':200, 
            'overlayShow':false,
            'autoScale': true,
            'type': 'iframe',
            'scrolling': 'no',
            'width': 350,
            'height': 220
        });
	
    });
</script>
<div id="left">
    <div id="left-menu-title">Report <%=lav.getPromozione().getNome()%> del <%=Util.FormatData(lav.getData(),"dd/MM/yyyy")%> </div>
    <div id="left-menu">
        <ul>
            <li><a class="group" style="<%=close%>" href="promoter/popup/mod_image.jsp?lavoroid=<%=idLav%>">Immagini (0)</a></li>
            <li><a style="<%=close%>" href="?page=report&where=document">Documenti (0)</a></li>
            <li><a style="<%=close%>" href="?page=report&where=survey">Sondaggi (0)</a></li>
            <li><a class="group" style="<%=close%>" href="promoter/left/popup.import.jsp">Importa</a></li>
            <li><a style="<%=close%>" href="?page=report&where=send">Invia</a></li>
        </ul>
        <div id="left-menu-title">Ricerca Prodotto</div>
        <div style="font-size: 11px;margin-top: 4px;text-align: left;"><input style="width: 200px;" type="text" id="search" class="search" placeholder="Digita qui il nome o il codice del Prodotto"  onkeypress="javascript:focus();" value=""/></div>
        <div style="margin-top: 5px;" id="result"></div>
    </div>
    <script>
        $("#search").keyup(function () {
            $.post("promoter/left/result.popup.jsp",{
                search:$("#search").val(),
                lavoroid: <%=request.getParameter("lavoroid")%>
            } , function(data){
                $("#result").html(data);
            });
        });
    </script>
</div>

